<!-- 导航条
================================================== -->

<div id="header">
    <div class="top_nav">
        <div class="wrapper">
            <div class="collection">
                <ul>
                    <li><a href="{:U('Index/index')}">首页</a>| </li>
                    <li><a href="javascript:void(0);">收藏本站</a> </li>
                </ul>
            </div>
            <div class="login">
                <if condition="is_login()">
                    <ul>
                        <li><a href="{:U('User/logout')}">{:get_username()}</a></li>
                        <li><a href="{:U('User/logout')}">退出</a></li>
                    </ul>
                <else/>
                    <ul>
                        <li><a href="javascript:void(0);">登录</a>| </li>
                        <li><a href="javascript:void(0);">注册</a> </li>
                    </ul>
                </if>
            </div>
        </div>
    </div>
    <div class="wrapper">
        <div class="logo"><a href="{:U('Index/index')}"> <img src="PUBLIC/Home/images/logo.png" alt=""/></a></div>
        <div class="nav">
            <ul>
                <think:nav name="nav">
                    <li>
                        <a href="{$nav.url|get_nav_url}">{$nav.title}</a>
                    </li>
                </think:nav>
            </ul>
        </div>
    </div>
    <div class="theme-popover">
        <div class="theme-poptit">
            <a href="javascript:;" title="关闭" class="close"><img src="PUBLIC/Home/images/res_03.png" alt=""/></a>
        </div>
        <form class="login_dl" name="form1" method="post">
            <div class="login_tab">
                <ul>
                    <li><span><img src="PUBLIC/Home/images/login_1.png" alt=""/></span>登录</li>
                    <li><span><img src="PUBLIC/Home/images/res_2.png" alt=""/></span>注册</li>
                </ul>
            </div>
            <div class="login_res">
                <!--登录-->
                <div class="login_con">
                    <ul>
                        <li>
                            帐号：
                            <input type="text" name="username" placeholder="邮箱/手机号"/>
                        </li>
                        <li>
                            密码：
                            <input type="password" name="password"/>
                        </li>
                        <li>
                            验证：
                            <input type="text" maxlength="5" name="verify"  placeholder="验证码"/>
                            <div class="controls">
                                <img class="verifyimg reloadverify" alt="" src="{:U('User/verify')}" style="cursor:pointer;">
                            </div>
                        </li>
                        <li class="button"><button onclick="login()">登录</button><a class="forget_a" href="javascript:void(0);">忘记密码？</a> </li>
                    </ul>
                </div>
                <!--注册-->
                <div class="login_con register" style="display: none">
                    <ul>
                        <li>
                            用户名：
                            <input type="text" name="username2"/>
                        </li>
                        <li>
                            密码：
                            <input type="password" name="password2"/>
                        </li>
                        <li>
                            确认密码：
                            <input type="password" name="repassword2"/>
                        </li>
                        <li>
                            邮箱：
                            <input type="text" name="email2"/>
                        </li>

                        <li class="yzm">
                            <p><img id="lian" onclick="newhref()" alt="点击切换" src="{:U('User/verify2')}" ></p>
                            <p><input type="text" name="verify2"/></p>
                            <p>验证码：</p>
                        </li>
                        <li class="button"><button onclick="register()">注册</button></li>
                    </ul>

                </div>
            </div>
        </form>

        <!-- 忘记密码 开始 -->
        <div class="popBox forBox">
            <a class="delete" href="javascript:void(0);"><img src="PUBLIC/Home/images/res_03.png" /></a>
            <h2>忘记密码</h2>
            <input type="text" placeholder="手机号" />
            <div class="code1"><input type="text" placeholder="短信验证码" /><a href="javascript:void(0);">获取验证码</a></div>
            <div class="code2"><input type="text" placeholder="验证码" /><img src="PUBLIC/Home/images/res_07.png" /><a href="javascript:void(0);">换一张？</a></div>
            <a class="btnCommon" href="javascript:void(0);">下一步</a>
        </div>
        <!-- 忘记密码 结束 -->
        <!-- 找回密码 开始 -->
        <div class="popBox pasdBox">
            <a class="delete" href="javascript:void(0);"><img src="PUBLIC/Home/images/res_03.png" /></a>
            <h2>找回密码</h2>
            <input type="password" placeholder="请输入新密码" />
            <input type="password" placeholder="请再次输入新密码" />
            <a class="btnCommon" href="javascript:void(0);">提交修改</a>
        </div>
        <!-- 找回密码 结束 -->

    </div>
</div>


<block name="script">
    <script type="text/javascript">

        function login(){
            form1.action = "{:U('User/login')}";
            form1.submit();
        }
        function register(){
            form1.action = "{:U('User/register')}";
            form1.submit();
        }
        function newhref(){
            var a = document.getElementById('lian');
            a.src = "{:U('User/verify2')}";
//            console.log(a);
        }

        $(document)
                .ajaxStart(function(){
                    $("button:submit").addClass("log-in").attr("disabled", true);
                })
                .ajaxStop(function(){
                    $("button:submit").removeClass("log-in").attr("disabled", false);
                });


        $("form").submit(function(){
            var self = $(this);
            $.post(self.attr("action"), self.serialize(), success, "json");
            return false;

            function success(data){
                if(data.status){
                    window.location.href = data.url;
                } else {
                    self.find(".Validform_checktip").text(data.info);
                    //刷新验证码
                    $(".reloadverify").click();
//                    $(".reloadverify2").click();
                }
            }
        });

        $(function(){
            var verifyimg = $(".verifyimg").attr("src");
//            var verifyimg2 = $(".verifyimg2").attr("src");
//            console.log(verifyimg);
            $(".reloadverify").click(function(){
                if( verifyimg.indexOf('?')>0){
                    $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
//                    $(".verifyimg2").attr("src", verifyimg2+'&random='+Math.random());
                }else{
                    $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
//                    $(".verifyimg2").attr("src", verifyimg2+'&random='+Math.random());
                }
            });
        });
    </script>
</block>